<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2022/10/5
  Time: 16:04
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
  <head>
    <title>login2</title>
  </head>
  <body>
  <form action="LoginServlet2" method="post" id="commit">
    <input type="hidden" name="token" id="token">
    用户名： <input type="text" name="username" id="username"/>
    <input type="submit" value="提交" />
  </form>
  </body>
  <script>
    window.onload=function (){
        var cookies=document.cookie;
        if (cookies!==""){
          var cookies1=cookies.split("=");
          var cookies2=cookies1[1];
          document.getElementById("token").value=cookies2;
    console.log(cookies2);
        }else {
          document.getElementById("token").value=0;
        }

    }
  </script>
</html>
